/**
* Group Detail
* ============================================================================
*/

.group-detail {
  position: relative;

  h3 {
    font-size: 22px;
    margin: 0 0 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;

    em {
      font-style: normal;
      font-weight: 400;
      color: @70;
      font-size: 90%;
    }
  }

  .count {
    font-size: 22px;
    display: inline-block;
    line-height: 1.2;
  }

  .meta {
    margin: 0 0 15px;
    color: #949ea4;
  }

  .severity {
    display: inline-block;
    position: relative;
    top: -7px;
    padding: 0 10px;
  }
}

/**
* Event Details
* ============================================================================
*/

.event-details-container {
  display: flex;
  margin: -20px -40px;
  background: #fff;
  flex-direction: column;
  flex: 1;

  @media (min-width: 1200px) {
    flex-direction: row;
  }

  .primary {
    flex: 1;

    @media (min-width: 1200px) {
      // TODO(dcramer): whatever flex is doing here is causing this to extend to
      // whatever it pleases (e.g. 4k pixels on my 1280 screen)
      max-width: ~'calc(100% - 365px)';
    }
  }

  .secondary {
    width: 100%;
    padding: 30px 40px 30px 30px;
    border-left: 1px solid @trim;

    @media (min-width: 1200px) {
      width: 365px;
    }
  }
}

.module-user .avatar {
  width: 64px;
  height: 64px;

  img {
    height: 100%;
    width: 100%;
  }
}


/**
* Traceback
* ============================================================================
*/

.traceback {
  list-style-type: none;
  padding-left: 0;
  border: 1px solid @trim-dark;
  border-radius: 0 6px 6px 6px;
  margin-bottom: 20px;
}

// TODO(dcramer): we probably shouldn't overload these
pre.traceback {
  margin: 0 0 20px;
}

div.traceback > ul {
  padding: 0;
  margin-bottom: 0;

  li {
    &:first-child {
      border-top: none;

      .title {
        border-top: none;
        border-top-right-radius: 5px;
        border-top-left-radius: 5px;
      }
    }

    &:last-child .title {
      border-bottom-right-radius: 5px;
      border-bottom-left-radius: 5px;
    }
  }
}

/**
* Frame
* ============================================================================
*/

.exception {
  margin: 0 0 20px;

  &:last-child {
    border-bottom: 0;
    margin-bottom: 0;
  }

  h5 {
    line-height: 1.2;
  }

  .traceback {
    margin-top: 15px;
  }
}

.traceback {
  &.no-exception .frame:first-child {
    border-top: 0;
  }

  .frame {
    list-style-type: none;
    position: relative;
    margin: 0;
    border-top: 1px solid @trim;

    h3 {
      font-size: 22px;
    }

    &.is-expandable .title {
      cursor: pointer;
    }

    .title {
      padding: 6px 20px;
      font-size: 12px;
      margin: 0;
      line-height: 16px;
      background: #faf9fb;

      word-break: break-all;
      /* for firefox */
      word-break: break-word;
      /* for chrome */

      code {
        font-family: inherit;
      }

      .informal {
        font-style: italic;
      }
    }

    .title.as-table {
      width: 100%;
      padding-left: 15px;

      .package {
        font-size: 12px;
        font-weight: bold;
        .truncate();
        flex-basis: 120px;
        flex-grow: 0;
        flex-shrink: 0;
      }

      .address {
        font-family: @font-family-code;
        font-size: 11px;
        color: @gray-dark;
        letter-spacing: -0.25px;
        width: 100px;
        flex-grow: 0;
        flex-shrink: 0;
      }

      .symbol {
        word-break: break-word;
        flex: 1;

        code {
          background: transparent;
          color: @blue-dark;
          padding-right: 5px;

          a {
            color: inherit;

            &:hover {
              text-decoration: underline;
            }
          }
        }

        span.offset {
          font-weight: bold;
          padding-right: 10px;
        }

        span.filename {
          color: @purple;
          margin-right: 3px;

          &:before {
            content: '(';
          }

          &:after {
            content: ')';
          }
        }
      }
    }

    .icon-open {
      font-size: 12px;
      margin-right: 3px;
      margin-left: 3px;
      position: relative;
      top: 1px;
    }

    .in-at {
      opacity: 0.6;
      margin: 0 2px;
    }

    .tooltip-inner {
      word-wrap: break-word;
      text-align: left;
      max-width: 300px;
    }

    .divider {
      border-left: 1px solid @trim;
      display: inline-block;
      width: 1px;
      height: 10px;
      margin: 0 6px;
      position: relative;
      top: 1px;
    }

    code {
      padding: 0;
      background: inherit;
      font-size: inherit;
      color: inherit;
    }

    .context {
      display: none;
      background: #fff;
      margin: 0;

      table.key-value {
        border-top: 1px solid @trim;
        padding: 0;
        margin: 0;

        td {
          border-bottom: 1px solid @trim !important;

          &.key {
            width: 145px;
            max-width: 145px;
            padding-left: 20px !important;
          }

          &.value pre {
            background: inherit;
          }
        }

        tr:last-child {
          td {
            border-bottom: 0 !important;
          }
        }
      }

      &.expanded {
        display: block;
      }
    }

    .tag-app {
      color: #aaa;
      font-size: 0.9em;
      margin-left: 10px;
    }

    > div > table.key-value {
      margin-bottom: 5px;

      > tbody > tr > th {
        color: @gray-dark;
        text-align: right;
        padding-right: 12px !important;
      }
    }

    .btn-toggle {
      display: block;
      float: right;
      width: 16px;
      height: 16px;
      padding: 0;
      line-height: 16px;
      font-size: 9px;
      text-align: center;
      flex-shrink: 0;
    }

    .expand-button:hover {
      cursor: pointer;
    }

    &.expanded {
      .expandable {
        height: auto;
        max-width: 100%;
      }
    }

    &:last-child {
      .context {
        margin-bottom: 0;
      }

      .toggle-expand .btn {
        margin-bottom: -13px;
      }
    }
  }

  &.in-app-traceback .frame.leads-to-app {
    .leads-to-app-hint {
      display: none;
    }

    &.collapsed {
      .title {
        background: #faf9fb;
        min-height: 32px;

        &.is-expandable:hover {
          opacity: 1;
        }

        .package {
          width: auto;
        }
      }

      .title.as-table {
        padding-left: 15px;
      }

      .in-at-line,
      .lineno,
      .address {
        display: none;
      }

      .leads-to-app-hint {
        display: inline;
        color: @gray-light;
      }
    }
  }

  &.full-traceback {
    .leads-to-app-hint {
      display: none !important;
    }
  }

  .expandable {
    height: 0;
    position: relative;

    .icon-plus {
      position: absolute;
      left: 8px;
      top: 6px;
      opacity: 0.25;
      transition: 0.1s opacity linear;
    }

    &.key-value {
      display: none;
    }

    .ws {
      display: none;
      overflow: hidden;
    }

    &:hover {
      .icon-plus {
        opacity: 0.5;
      }
    }
  }

  .expanded {
    .expandable {
      height: auto;
    }

    .ws {
      display: inline;
      overflow: none;
    }
  }

  ol.context {
    margin: 0;
    list-style-position: inside;
    list-style-type: decimal-leading-zero;
    border-radius: 5px;
    padding-left: 0;

    .key-value {
      display: none;

      pre {
        overflow: auto;
      }
    }

    > li {
      font-family: @font-family-code;
      line-height: 24px;
      font-size: 12px;
      white-space: pre;
      white-space: pre-wrap;
      word-wrap: break-word;
      min-height: 24px;
    }

    > li.active {
      list-style-type: none;
      border-radius: 2px;

      &:first-child:last-child {
        background-color: inherit;
        color: inherit;
        border-radius: 0;
      }

      pre {
        color: @gray-dark;
      }
    }

    > li:first-child {
      border-radius: 2px 2px 0 0;
    }

    > li:last-of-type {
      border-radius: 0 0 2px 2px;
    }

    li.closed {
      border-radius: 2px;
    }

    &.expanded {
      .key-value {
        display: table;
      }

      > li.active {
        position: relative;
        z-index: 0;
        list-style-type: inherit;
        border-radius: 0;
      }
    }
  }

  ol.context-line {
    > li {
      > span {
        float: right;
      }
    }
  }
}

&.expanded div.commands,
div.commands:hover {
  opacity: 1;

  a {
    color: @state-info-text;
  }
}

div.commands {
  position: absolute;
  right: 10px;
  top: 6px;
  font-size: 0.9em;
  opacity: 0.3;

  a {
    color: #666;
    text-decoration: none;

    span {
      font-size: 9px;
      margin-right: 5px;
    }
  }
}

// Request

.request {
  .path {
    font-weight: normal;
    float: left;

    strong {
      margin-right: 4px;
    }
  }
}

/* message details */
.server-list,
.url-list,
.logger-list,
.level-list {
  list-style: none;
  margin-left: 0;
  margin-bottom: 0;
}

.server-list li,
.url-list li {
  padding-bottom: 10px;
}

.url-list li a {
  line-height: 18px;
}

pre.val,
span.val {
  span {
    display: inline;
  }
}

.val-string {
  border-radius: 4px;
  padding: 2px 4px;
}

.val-string-multiline {
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/**
* Exceptions and Threads
* ============================================================================
*/
.box .thread {
  .exception {
    margin-top: 10px;
  }

  .traceback.no-exception {
    margin-top: 0;
  }
}

/**
* Shared Group Detail
* ============================================================================
*/

.shared-group {
  padding: 40px 0;
  background: none;

  .app > .container {
    max-width: 960px;

    > .box {
      > .box-header {
        padding: 15px 30px 13px;
        display: flex;
        align-items: center;

        a {
          &.logo {
            font-size: 20px;
            flex: 1;
          }

          &:hover {
            color: @gray-dark;
          }
        }
      }
    }
  }

  .container {
    padding-left: 0;
    padding-right: 0;
  }

  .group-detail {
    padding: 0 30px;
    border-bottom: 1px solid darken(@trim, 5);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.03);

    &:before {
      display: none;
    }

    .details {
      max-width: 960px;
      margin: 0 auto;
      padding: 20px 0 0;
    }
  }

  .event-details-container {
    display: block;
    margin: 0;

    .primary {
      max-width: 100%;

      .box {
        padding: 0 30px;

        &:first-child {
          border-top: 0;
        }
      }

      .box-header,
      .box-content {
        max-width: 960px;
        margin: 0 auto;
      }

      .box-header {
        margin-top: 15px;
      }

      .exception {
        padding: 20px 0;
        margin: 0;

        &:first-child {
          padding-top: 0;
        }
      }

      .traceback.no-exception {
        margin-bottom: 25px;
        margin-top: -5px;
      }
    }
  }
}

/**
* Responsive small screen
* ============================================================================
*/

@media (max-width: 767px) {
  .group-detail {
    h3 {
      white-space: normal;
      font-size: 20px;
      line-height: 1.2;
    }

    .meta {
      font-size: 12px;
    }
  }

  // Event detail columns

  .event-details-container {
    flex-direction: column;
    margin: 0;

    .primary {
      max-width: 100%;

      .box {
        padding: 15px 0;

        .box-header {
          h3 {
            margin: 0 0 10px;

            small {
              margin-left: 0 !important;
              display: block;
            }
          }

          .permalink {
            display: none;
          }
        }
      }

      .exception {
        margin: 0;
        padding: 15px 0;
      }

      .traceback {
        &.no-exception {
          margin: 0;
        }

        .btn-toggle {
          width: 17px;
        }
      }
    }

    .secondary {
      width: auto;
      padding: 0;
      border: 0;
      margin-bottom: 20px;
    }
  }
}
